声明 模块 "repl" {

    //@@{ 接口_:Interface, 完成_:Completer, 异步完成_:AsyncCompleter }
    导入 { 接口_, 完成_, 异步完成_ } 来自 "readline";

    //@@{ 上下文_:Context }
    导入 { 上下文_ } 来自 "vm";

    //@@{ 检查选项_:InspectOptions }
    导入 { 检查选项_ } 来自 "util";

    //@@{ Repl选项_:ReplOptions }
    接口 Repl选项_ {
        /**
         * The input prompt to display.
         * Default: `"> "`
         */

        //@@{ 提示:prompt }
        提示?: 文字;
        /**
         * The `Readable` stream from which REPL input will be read.
         * Default: `process.stdin`
         */

        //@@{ 输入:input, 可读流_:ReadableStream }
        输入?: NodeJS.可读流_;
        /**
         * The `Writable` stream to which REPL output will be written.
         * Default: `process.stdout`
         */

        //@@{ 输出:output, 可写流_:WritableStream }
        输出?: NodeJS.可写流_;
        /**
         * If `true`, specifies that the output should be treated as a TTY terminal, and have
         * ANSI/VT100 escape codes written to it.
         * Default: checking the value of the `isTTY` property on the output stream upon
         * instantiation.
         */

        //@@{ 终端:terminal }
        终端?: 真假;
        /**
         * The function to be used when evaluating each given line of input.
         * Default: an async wrapper for the JavaScript `eval()` function. An `eval` function can
         * error with `repl.Recoverable` to indicate the input was incomplete and prompt for
         * additional lines.
         *
         * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_default_evaluation
         * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_custom_evaluation_functions
         */

        //@@{ 执行:eval, REPL执行_:REPLEval }
        执行?: REPL执行_;
        /**
         * If `true`, specifies that the default `writer` function should include ANSI color
         * styling to REPL output. If a custom `writer` function is provided then this has no
         * effect.
         * Default: the REPL instance's `terminal` value.
         */

        //@@{ 使用颜色:useColors }
        使用颜色?: 真假;
        /**
         * If `true`, specifies that the default evaluation function will use the JavaScript
         * `global` as the context as opposed to creating a new separate context for the REPL
         * instance. The node CLI REPL sets this value to `true`.
         * Default: `false`.
         */

        //@@{ 使用全局:useGlobal }
        使用全局?: 真假;
        /**
         * If `true`, specifies that the default writer will not output the return value of a
         * command if it evaluates to `undefined`.
         * Default: `false`.
         */

        //@@{ 忽略未定义:ignoreUndefined }
        忽略未定义?: 真假;
        /**
         * The function to invoke to format the output of each command before writing to `output`.
         * Default: a wrapper for `util.inspect`.
         *
         * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_customizing_repl_output
         */

        //@@{ 写出:writer, REPL作家_:REPLWriter }
        写出?: REPL作家_;
        /**
         * An optional function used for custom Tab auto completion.
         *
         * @see https://nodejs.org/dist/latest-v11.x/docs/api/readline.html#readline_use_of_the_completer_function
         */

        //@@{ 完成:completer, 完成_:Completer, 异步完成_:AsyncCompleter }
        完成?: 完成_ | 异步完成_;
        /**
         * A flag that specifies whether the default evaluator executes all JavaScript commands in
         * strict mode or default (sloppy) mode.
         * Accepted values are:
         * - `repl.REPL_MODE_SLOPPY` - evaluates expressions in sloppy mode.
         * - `repl.REPL_MODE_STRICT` - evaluates expressions in strict mode. This is equivalent to
         *   prefacing every repl statement with `'use strict'`.
         */

        //@@{ repl模式:replMode, __REPL_模式_宽松__:REPL_MODE_SLOPPY, __REPL_模式_严格__:REPL_MODE_STRICT }
        repl模式?: 类为 __REPL_模式_宽松__ | 类为 __REPL_模式_严格__;
        /**
         * Stop evaluating the current piece of code when `SIGINT` is received, i.e. `Ctrl+C` is
         * pressed. This cannot be used together with a custom `eval` function.
         * Default: `false`.
         */

        //@@{ 发现停止信号停止执行:breakEvalOnSigint }
        发现停止信号停止执行?: 真假;
    }

    //@@{ REPL执行_:REPLEval, REPL服务器_:REPLServer, 上下文_:Context, 错误_:Error }
    类型 REPL执行_ = (本体: REPL服务器_, 执行命令: 文字, 上下文: 上下文_, 文件: 文字, 回调: (错: 错误_ | 空值, 结果: 任意) => 无值) => 无值;

    //@@{ REPL作家_:REPLWriter, REPL服务器_:REPLServer }
    类型 REPL作家_ = (本体: REPL服务器_, 对象: 任意) => 文字;

    /**
     * This is the default "writer" value, if none is passed in the REPL options,
     * and it can be overridden by custom print functions.
     */

    //@@{ 写出:writer, REPL作家_:REPLWriter, 选项组:options, 检查选项_:InspectOptions }
    常量 写出: REPL作家_ & { 选项组: 检查选项_ };

    //@@{ REPL命令动作_:REPLCommandAction, REPL服务器_:REPLServer }
    类型 REPL命令动作_ = (本体: REPL服务器_, 文本: 文字) => 无值;

    //@@{ REPL命令_:REPLCommand }
    接口 REPL命令_ {
        /**
         * Help text to be displayed when `.help` is entered.
         */

        //@@{ 帮助:help }
        帮助?: 文字;
        /**
         * The function to execute, optionally accepting a single string argument.
         */

        //@@{ 动作:action, REPL命令动作_:REPLCommandAction }
        动作: REPL命令动作_;
    }

    /**
     * Provides a customizable Read-Eval-Print-Loop (REPL).
     *
     * Instances of `repl.REPLServer` will accept individual lines of user input, evaluate those
     * according to a user-defined evaluation function, then output the result. Input and output
     * may be from `stdin` and `stdout`, respectively, or may be connected to any Node.js `stream`.
     *
     * Instances of `repl.REPLServer` support automatic completion of inputs, simplistic Emacs-style
     * line editing, multi-line inputs, ANSI-styled output, saving and restoring current REPL session
     * state, error recovery, and customizable evaluation functions.
     *
     * Instances of `repl.REPLServer` are created using the `repl.start()` method and _should not_
     * be created directly using the JavaScript `new` keyword.
     *
     * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_repl
     */

    //@@{ REPL服务器_:REPLServer, 接口_:Interface }
    类别 REPL服务器_ 扩展 接口_ {
        /**
         * The `vm.Context` provided to the `eval` function to be used for JavaScript
         * evaluation.
         */

        //@@{ 上下文:context, 上下文_:Context }
        只读 上下文: 上下文_;
        /**
         * The `Readable` stream from which REPL input will be read.
         */

        //@@{ 输入流:inputStream, 可读流_:ReadableStream }
        只读 输入流: NodeJS.可读流_;
        /**
         * The `Writable` stream to which REPL output will be written.
         */

        //@@{ 输出流:outputStream, 可写流_:WritableStream }
        只读 输出流: NodeJS.可写流_;
        /**
         * The commands registered via `replServer.defineCommand()`.
         */

        //@@{ 命令:commands, REPL命令_:REPLCommand }
        只读 命令: { 只读 [名称: 文字]: REPL命令_ | 未定 };
        /**
         * A value indicating whether the REPL is currently in "editor mode".
         *
         * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_commands_and_special_keys
         */

        //@@{ 编辑模式:editorMode }
        只读 编辑模式: 真假;
        /**
         * A value indicating whether the `_` variable has been assigned.
         *
         * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
         */

        //@@{ 已分配下划线:underscoreAssigned }
        只读 已分配下划线: 真假;
        /**
         * The last evaluation result from the REPL (assigned to the `_` variable inside of the REPL).
         *
         * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
         */

        //@@{ 最后的:last }
        只读 最后的: 任意;
        /**
         * A value indicating whether the `_error` variable has been assigned.
         *
         * @since v9.8.0
         * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
         */

        //@@{ 下划线错误已分配:underscoreErrAssigned }
        只读 下划线错误已分配: 真假;
        /**
         * The last error raised inside the REPL (assigned to the `_error` variable inside of the REPL).
         *
         * @since v9.8.0
         * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable
         */

        //@@{ 最后错误:lastError }
        只读 最后错误: 任意;
        /**
         * Specified in the REPL options, this is the function to be used when evaluating each
         * given line of input. If not specified in the REPL options, this is an async wrapper
         * for the JavaScript `eval()` function.
         */

        //@@{ 执行:eval, REPL执行_:REPLEval }
        只读 执行: REPL执行_;
        /**
         * Specified in the REPL options, this is a value indicating whether the default
         * `writer` function should include ANSI color styling to REPL output.
         */

        //@@{ 使用颜色:useColors }
        只读 使用颜色: 真假;
        /**
         * Specified in the REPL options, this is a value indicating whether the default `eval`
         * function will use the JavaScript `global` as the context as opposed to creating a new
         * separate context for the REPL instance.
         */

        //@@{ 使用全局:useGlobal }
        只读 使用全局: 真假;
        /**
         * Specified in the REPL options, this is a value indicating whether the default `writer`
         * function should output the result of a command if it evaluates to `undefined`.
         */

        //@@{ 忽略未定义:ignoreUndefined }
        只读 忽略未定义: 真假;
        /**
         * Specified in the REPL options, this is the function to invoke to format the output of
         * each command before writing to `outputStream`. If not specified in the REPL options,
         * this will be a wrapper for `util.inspect`.
         */

        //@@{ 写出:writer, REPL作家_:REPLWriter }
        只读 写出: REPL作家_;
        /**
         * Specified in the REPL options, this is the function to use for custom Tab auto-completion.
         */

        //@@{ 完成:completer, 完成_:Completer, 异步完成_:AsyncCompleter }
        只读 完成: 完成_ | 异步完成_;
        /**
         * Specified in the REPL options, this is a flag that specifies whether the default `eval`
         * function should execute all JavaScript commands in strict mode or default (sloppy) mode.
         * Possible values are:
         * - `repl.REPL_MODE_SLOPPY` - evaluates expressions in sloppy mode.
         * - `repl.REPL_MODE_STRICT` - evaluates expressions in strict mode. This is equivalent to
         *    prefacing every repl statement with `'use strict'`.
         */

        //@@{ repl模式:replMode, __REPL_模式_宽松__:REPL_MODE_SLOPPY, __REPL_模式_严格__:REPL_MODE_STRICT }
        只读 repl模式: 类为 __REPL_模式_宽松__ | 类为 __REPL_模式_严格__;

        /**
         * NOTE: According to the documentation:
         *
         * > Instances of `repl.REPLServer` are created using the `repl.start()` method and
         * > _should not_ be created directly using the JavaScript `new` keyword.
         *
         * `REPLServer` cannot be subclassed due to implementation specifics in NodeJS.
         *
         * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_class_replserver
         */
        私有 构造();

        /**
         * Used to add new `.`-prefixed commands to the REPL instance. Such commands are invoked
         * by typing a `.` followed by the `keyword`.
         *
         * @param keyword The command keyword (_without_ a leading `.` character).
         * @param cmd The function to invoke when the command is processed.
         *
         * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_replserver_definecommand_keyword_cmd
         */

        //@@{ 定义命令:defineCommand, REPL命令动作_:REPLCommandAction, REPL命令_:REPLCommand }
        定义命令(关键字: 文字, 命令: REPL命令动作_ | REPL命令_): 无值;
        /**
         * Readies the REPL instance for input from the user, printing the configured `prompt` to a
         * new line in the `output` and resuming the `input` to accept new input.
         *
         * When multi-line input is being entered, an ellipsis is printed rather than the 'prompt'.
         *
         * This method is primarily intended to be called from within the action function for
         * commands registered using the `replServer.defineCommand()` method.
         *
         * @param preserveCursor When `true`, the cursor placement will not be reset to `0`.
         */

        //@@{ 显示提示:displayPrompt }
        显示提示(保护指针?: 真假): 无值;
        /**
         * Clears any command that has been buffered but not yet executed.
         *
         * This method is primarily intended to be called from within the action function for
         * commands registered using the `replServer.defineCommand()` method.
         *
         * @since v9.0.0
         */

        //@@{ 清除缓冲命令:clearBufferedCommand }
        清除缓冲命令(): 无值;

        /**
         * Initializes a history log file for the REPL instance. When executing the
         * Node.js binary and using the command line REPL, a history file is initialized
         * by default. However, this is not the case when creating a REPL
         * programmatically. Use this method to initialize a history log file when working
         * with REPL instances programmatically.
         * @param path The path to the history file
         */

        //@@{ 安装历史:setupHistory, 错误_:Error }
        安装历史(路径: 文字, 回调: (错: 错误_ | 空值, repl: 本体) => 无值): 无值;

        /**
         * events.EventEmitter
         * 1. close - inherited from `readline.Interface`
         * 2. line - inherited from `readline.Interface`
         * 3. pause - inherited from `readline.Interface`
         * 4. resume - inherited from `readline.Interface`
         * 5. SIGCONT - inherited from `readline.Interface`
         * 6. SIGINT - inherited from `readline.Interface`
         * 7. SIGTSTP - inherited from `readline.Interface`
         * 8. exit
         * 9. reset
         */

        //@@{ 添加监听器:addListener }
        添加监听器(事件: 文字, 监听器: (...参数组: 任意[]) => 无值): 本体;

        //@@{ 添加监听器:addListener, "关闭":"close" }
        添加监听器(事件: "关闭", 监听器: () => 无值): 本体;

        //@@{ 添加监听器:addListener, "行":"line" }
        添加监听器(事件: "行", 监听器: (输入: 文字) => 无值): 本体;

        //@@{ 添加监听器:addListener, "暂停":"pause" }
        添加监听器(事件: "暂停", 监听器: () => 无值): 本体;

        //@@{ 添加监听器:addListener, "恢复":"resume" }
        添加监听器(事件: "恢复", 监听器: () => 无值): 本体;

        //@@{ 添加监听器:addListener, "__信号_继续信号__":"SIGCONT" }
        添加监听器(事件: "__信号_继续信号__", 监听器: () => 无值): 本体;

        //@@{ 添加监听器:addListener, "__信号_键盘中断__":"SIGINT" }
        添加监听器(事件: "__信号_键盘中断__", 监听器: () => 无值): 本体;

        //@@{ 添加监听器:addListener, "__信号_终端输入停止__":"SIGTSTP" }
        添加监听器(事件: "__信号_终端输入停止__", 监听器: () => 无值): 本体;

        //@@{ 添加监听器:addListener, "退出":"exit" }
        添加监听器(事件: "退出", 监听器: () => 无值): 本体;

        //@@{ 添加监听器:addListener, "重置":"reset", 上下文_:Context }
        添加监听器(事件: "重置", 监听器: (上下文: 上下文_) => 无值): 本体;

        //@@{ 发出:emit }
        发出(事件: 文字 | 符号, ...参数组: 任意[]): 真假;

        //@@{ 发出:emit, "关闭":"close" }
        发出(事件: "关闭"): 真假;

        //@@{ 发出:emit, "行":"line" }
        发出(事件: "行", 输入: 文字): 真假;

        //@@{ 发出:emit, "暂停":"pause" }
        发出(事件: "暂停"): 真假;

        //@@{ 发出:emit, "恢复":"resume" }
        发出(事件: "恢复"): 真假;

        //@@{ 发出:emit, "__信号_继续信号__":"SIGCONT" }
        发出(事件: "__信号_继续信号__"): 真假;

        //@@{ 发出:emit, "__信号_键盘中断__":"SIGINT" }
        发出(事件: "__信号_键盘中断__"): 真假;

        //@@{ 发出:emit, "__信号_终端输入停止__":"SIGTSTP" }
        发出(事件: "__信号_终端输入停止__"): 真假;

        //@@{ 发出:emit, "退出":"exit" }
        发出(事件: "退出"): 真假;

        //@@{ 发出:emit, "重置":"reset", 上下文_:Context }
        发出(事件: "重置", 上下文: 上下文_): 真假;

        //@@{ 正在:on }
        正在(事件: 文字, 监听器: (...参数组: 任意[]) => 无值): 本体;

        //@@{ 正在:on, "关闭":"close" }
        正在(事件: "关闭", 监听器: () => 无值): 本体;

        //@@{ 正在:on, "行":"line" }
        正在(事件: "行", 监听器: (输入: 文字) => 无值): 本体;

        //@@{ 正在:on, "暂停":"pause" }
        正在(事件: "暂停", 监听器: () => 无值): 本体;

        //@@{ 正在:on, "恢复":"resume" }
        正在(事件: "恢复", 监听器: () => 无值): 本体;

        //@@{ 正在:on, "__信号_继续信号__":"SIGCONT" }
        正在(事件: "__信号_继续信号__", 监听器: () => 无值): 本体;

        //@@{ 正在:on, "__信号_键盘中断__":"SIGINT" }
        正在(事件: "__信号_键盘中断__", 监听器: () => 无值): 本体;

        //@@{ 正在:on, "__信号_终端输入停止__":"SIGTSTP" }
        正在(事件: "__信号_终端输入停止__", 监听器: () => 无值): 本体;

        //@@{ 正在:on, "退出":"exit" }
        正在(事件: "退出", 监听器: () => 无值): 本体;

        //@@{ 正在:on, "重置":"reset", 上下文_:Context }
        正在(事件: "重置", 监听器: (上下文: 上下文_) => 无值): 本体;

        //@@{ 一次:once }
        一次(事件: 文字, 监听器: (...参数组: 任意[]) => 无值): 本体;

        //@@{ 一次:once, "关闭":"close" }
        一次(事件: "关闭", 监听器: () => 无值): 本体;

        //@@{ 一次:once, "行":"line" }
        一次(事件: "行", 监听器: (输入: 文字) => 无值): 本体;

        //@@{ 一次:once, "暂停":"pause" }
        一次(事件: "暂停", 监听器: () => 无值): 本体;

        //@@{ 一次:once, "恢复":"resume" }
        一次(事件: "恢复", 监听器: () => 无值): 本体;

        //@@{ 一次:once, "__信号_继续信号__":"SIGCONT" }
        一次(事件: "__信号_继续信号__", 监听器: () => 无值): 本体;

        //@@{ 一次:once, "__信号_键盘中断__":"SIGINT" }
        一次(事件: "__信号_键盘中断__", 监听器: () => 无值): 本体;

        //@@{ 一次:once, "__信号_终端输入停止__":"SIGTSTP" }
        一次(事件: "__信号_终端输入停止__", 监听器: () => 无值): 本体;

        //@@{ 一次:once, "退出":"exit" }
        一次(事件: "退出", 监听器: () => 无值): 本体;

        //@@{ 一次:once, "重置":"reset", 上下文_:Context }
        一次(事件: "重置", 监听器: (上下文: 上下文_) => 无值): 本体;

        //@@{ 预处理监听器:prependListener }
        预处理监听器(事件: 文字, 监听器: (...参数组: 任意[]) => 无值): 本体;

        //@@{ 预处理监听器:prependListener, "关闭":"close" }
        预处理监听器(事件: "关闭", 监听器: () => 无值): 本体;

        //@@{ 预处理监听器:prependListener, "行":"line" }
        预处理监听器(事件: "行", 监听器: (输入: 文字) => 无值): 本体;

        //@@{ 预处理监听器:prependListener, "暂停":"pause" }
        预处理监听器(事件: "暂停", 监听器: () => 无值): 本体;

        //@@{ 预处理监听器:prependListener, "恢复":"resume" }
        预处理监听器(事件: "恢复", 监听器: () => 无值): 本体;

        //@@{ 预处理监听器:prependListener, "__信号_继续信号__":"SIGCONT" }
        预处理监听器(事件: "__信号_继续信号__", 监听器: () => 无值): 本体;

        //@@{ 预处理监听器:prependListener, "__信号_键盘中断__":"SIGINT" }
        预处理监听器(事件: "__信号_键盘中断__", 监听器: () => 无值): 本体;

        //@@{ 预处理监听器:prependListener, "__信号_终端输入停止__":"SIGTSTP" }
        预处理监听器(事件: "__信号_终端输入停止__", 监听器: () => 无值): 本体;

        //@@{ 预处理监听器:prependListener, "退出":"exit" }
        预处理监听器(事件: "退出", 监听器: () => 无值): 本体;

        //@@{ 预处理监听器:prependListener, "重置":"reset", 上下文_:Context }
        预处理监听器(事件: "重置", 监听器: (上下文: 上下文_) => 无值): 本体;

        //@@{ 预处理一次监听器:prependOnceListener }
        预处理一次监听器(事件: 文字, 监听器: (...参数组: 任意[]) => 无值): 本体;

        //@@{ 预处理一次监听器:prependOnceListener, "关闭":"close" }
        预处理一次监听器(事件: "关闭", 监听器: () => 无值): 本体;

        //@@{ 预处理一次监听器:prependOnceListener, "行":"line" }
        预处理一次监听器(事件: "行", 监听器: (输入: 文字) => 无值): 本体;

        //@@{ 预处理一次监听器:prependOnceListener, "暂停":"pause" }
        预处理一次监听器(事件: "暂停", 监听器: () => 无值): 本体;

        //@@{ 预处理一次监听器:prependOnceListener, "恢复":"resume" }
        预处理一次监听器(事件: "恢复", 监听器: () => 无值): 本体;

        //@@{ 预处理一次监听器:prependOnceListener, "__信号_继续信号__":"SIGCONT" }
        预处理一次监听器(事件: "__信号_继续信号__", 监听器: () => 无值): 本体;

        //@@{ 预处理一次监听器:prependOnceListener, "__信号_键盘中断__":"SIGINT" }
        预处理一次监听器(事件: "__信号_键盘中断__", 监听器: () => 无值): 本体;

        //@@{ 预处理一次监听器:prependOnceListener, "__信号_终端输入停止__":"SIGTSTP" }
        预处理一次监听器(事件: "__信号_终端输入停止__", 监听器: () => 无值): 本体;

        //@@{ 预处理一次监听器:prependOnceListener, "退出":"exit" }
        预处理一次监听器(事件: "退出", 监听器: () => 无值): 本体;

        //@@{ 预处理一次监听器:prependOnceListener, "重置":"reset", 上下文_:Context }
        预处理一次监听器(事件: "重置", 监听器: (上下文: 上下文_) => 无值): 本体;
    }

    /**
     * A flag passed in the REPL options. Evaluates expressions in sloppy mode.
     */

    //@@{ __REPL_模式_宽松__:REPL_MODE_SLOPPY }
    导出 常量 __REPL_模式_宽松__: 符号; // TODO: unique symbol

    /**
     * A flag passed in the REPL options. Evaluates expressions in strict mode.
     * This is equivalent to prefacing every repl statement with `'use strict'`.
     */

    //@@{ __REPL_模式_严格__:REPL_MODE_STRICT }
    导出 常量 __REPL_模式_严格__: 符号; // TODO: unique symbol

    /**
     * Creates and starts a `repl.REPLServer` instance.
     *
     * @param options The options for the `REPLServer`. If `options` is a string, then it specifies
     * the input prompt.
     */

    //@@{ 开始:start, Repl选项_:ReplOptions, REPL服务器_:REPLServer }
    函数 开始(选项组?: 文字 | Repl选项_): REPL服务器_;

    /**
     * Indicates a recoverable error that a `REPLServer` can use to support multi-line input.
     *
     * @see https://nodejs.org/dist/latest-v10.x/docs/api/repl.html#repl_recoverable_errors
     */

    //@@{ 可恢复的_:Recoverable, 语法错误_:SyntaxError }
    类别 可恢复的_ 扩展 语法错误_ {

        //@@{ 错:err, 错误_:Error }
        错: 错误_;

        //@@{ 错误_:Error }
        构造(错: 错误_);
    }
}
